import java.lang.Cloneable;
import java.awt.Graphics2D;

/**
 * The parent class for all shapes(including texts)
 * 
 * @author Chia-Chi (Teresa) Lee
 */ 
public class MyShape implements Cloneable {
  
  //The x,y coordinate where the user initiates the drawing
  private int x_s;
  private int y_s;
  
  //The x,y coordinate where the user ends the drawing
  private int x_e;
  private int y_e;
  
  public MyShape(){}
  
  public MyShape(int x_s, int x_e, int y_s, int y_e){
    this.x_s = x_s;
    this.x_e = x_e;
    this.y_s = y_s;
    this.y_e = y_e;
  }
  
  /**
   * Method for cloning a shape
   * 
   */
  public Object clone()
  {
     try
     {
          return super.clone();
     }
     catch( CloneNotSupportedException e )
     {
          return null;
     }
  }
  
  /**
   * Get the width of the bounding box
   * 
   */
  public int getWidth(){
    return Math.abs(this.x_e - this.x_s);
  }
  
  /**
   * Get the height of the bounding box
   * 
   */
  public int getHeight(){
    return Math.abs(this.y_e - this.y_s);
  }
  
  /**
   * Get the bounding box's top-left corner coordinate x. 
   * The point could either be the start x or the end x depending on
   * how the user creates the shape
   */
  public int getBounding_x(){
    int width = this.getX_e() - this.getX_s();
    return width < 0 ? this.getX_e() : this.getX_s();
  }
  
  /**
   * Get the bounding box's top-left corner coordinate y 
   * The point could either be the start y or the end y depending on
   * how the user creates the shape
   */
  public int getBounding_y(){
    int height = this.getY_e() - this.getY_s();
    return height < 0 ? this.getY_e() : this.getY_s();
  }
  
  /**
   * Get the bouding box's bottom-right corner coordinate x
   * 
   */
  public int getRightMost(){
    return getBounding_x() + getWidth();
  }
  
  /**
   * Get the bouding box's bottom-right corner coordinate y
   * 
   */
  public int getBottomMost(){
    return getBounding_y() + getHeight();
  }
  
  /**
   * Get the start x
   * 
   */
  public int getX_s(){
    return x_s; 
  };
  
  /**
   * Get the end x
   * 
   */
  public int getX_e(){
    return x_e; 
  };
  
  /**
   * Get the start y
   * 
   */
  public int getY_s(){
    return y_s; 
  };
  
  /**
   * Get the end y
   * 
   */
  public int getY_e(){
    return y_e; 
  };
  
  /**
   * Set start x
   * 
   */
  public void setX_s(int x_s){
    this.x_s = x_s;
  };
  
  /**
   * Set end x
   * 
   */
  public void setX_e(int x_e){
    this.x_e = x_e;
  };
  
  /**
   * Set start y
   * 
   */
  public void setY_s(int y_s){
    this.y_s = y_s;
  };
  
  /**
   * Set end y
   * 
   */
  public void setY_e(int y_e){
    this.y_e = y_e;
  };
  
  /**
   * Method for drawing the shape
   * 
   */
  public void drawMe(Graphics2D g, int screenWidth, int screenHeight) {
  }
  
  /**
   * Add characters to vector. This is mainly used by Text object
   * 
   */
  public void add(char c) {
  }
  
}